package com.frxuexi.lib_base.utils

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback
import com.alibaba.android.arouter.launcher.ARouter

class ArouterService:NavigationCallback{
    override fun onFound(postcard: Postcard?) {

    }

    override fun onLost(postcard: Postcard?) {
        postcard?.context.let {
            ARouter.getInstance().build("/app/NoFindActivity").navigation(it)
        }
    }

    override fun onArrival(postcard: Postcard?) {

    }

    override fun onInterrupt(postcard: Postcard?) {

    }

}

object ArouterManager{
    fun nav(context:Context,url:String,value:Int=-1){
        ARouter.getInstance().build(url).withInt("id",value).navigation(context,ArouterService())
    }
}